package com.zzyl.nursing.task;

import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.zzyl.nursing.domain.Contract;
import com.zzyl.nursing.mapper.ContractMapper;
import com.zzyl.nursing.service.IContractService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.time.LocalDate;

@Component("contractJob")
@Slf4j
public class ContractJob {

    @Autowired
    private IContractService contractService;
    /****
     * 定时任务
     * 每天凌晨1点执行，检查合同的状态是否有效（判断合同开始时间是否大于等于当前时间）
     */

    @Scheduled(cron = "0 0 1 * * ?")

    public void job(){
        contractService.updateContractStatus();

    }
}
